package cn.kgc.dm.controller;

import cn.kgc.dm.common.Dto;
import cn.kgc.dm.common.DtoUtil;
import cn.kgc.dm.service.LoginService;
import cn.kgc.dm.vo.DmUserRegisterVO;
import cn.kgc.dm.vo.DmUserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;

/**
 * @author: 12138
 * @CreateTime: 2019/05/14
 */
@RestController
@RequestMapping(value = "/api", method = RequestMethod.POST)
public class LoginController {
	
	@Autowired
	private LoginService loginService;
	
	@RequestMapping("/p/login")
	public Dto<ArrayList> login(@RequestBody DmUserRegisterVO dmUserRegisterVO, HttpServletRequest request) throws Exception {
		return DtoUtil.returnDataSuccess(loginService.login(dmUserRegisterVO.getPhone(), dmUserRegisterVO.getPassword(), request.getHeader("user-agent")));
	}
	
}


